﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using PetaPoco;
using HeimaSoft.Models;

namespace HeimaSoft.Controllers.Api
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class {subFolder}Controller  : BaseController
    {
	[folder start]

		#region {tblName}模块

        public ActionResult<string> [tblName]edit()
        {
            int id = GetInt("id");
            var form = Request.Form;
  [loop start]
			var [fldName] = GetString("[fldName]");
  [loop end]^

            Dictionary<string, string> dic = new Dictionary<string, string>()
            {
  [loop start]
                { "[fldName]","[fldTitle]不能为空" },
  [loop end]^

            };

			#region 新增处理
			var errorMsg = ValidateCheck(dic);
			if (errorMsg != "")
			{
				return ValidateError(errorMsg);
			}
			/*
			var mod = new {tblName}();
[loop start]
			mod.[fldName] = [fldName];
[loop end]^

			db.Insert(mod);
			if (mod.id > 0)
			{
				return Success(mod);
			}
			else
			{
				return Error("数据插入失败");
			}
			*/
			return "";
			#endregion

        }

		#endregion

	[folder end]

	}
}